package com.neusoft.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.neusoft.bean.AdminInfoBean;
import com.neusoft.bean.AdminInfoBeanDTO;
import com.neusoft.myutils.MyUtil;
import com.neusoft.service.AdminInfoService;

@WebServlet("/AdminInfoQueryServlet")
public class AdminInfoQueryServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 获取form表单数据
		AdminInfoBeanDTO adminB = MyUtil.convertRequestParameters2Bean(request, AdminInfoBeanDTO.class);
		// 调用service方法进行数据库查询操作
		List<AdminInfoBean> lstAdmins = MyUtil.getNewInstance(AdminInfoService.class).getAdminInfoByParas(adminB);
		// 在跳转页面之前，将查询结果保存到session中
		request.getSession().setAttribute("lstAdmins", lstAdmins);
		// 保存成功,转到保存成功的页面
		response.sendRedirect("logined/adminInfoManger/adminInfoQuery.jsp");
	}

}
